package shop.yaojianfeng.springlearning.section9.controller;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import shop.yaojianfeng.springlearning.section9.entity.SysUser;
import shop.yaojianfeng.springlearning.section9.service.impl.SysUserServiceImpl;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 登录认证的控制器
 *
 * @author yaojianfeng
 */
@Controller
@RequestMapping("/sys")
public class LoginController {
    @Resource
    SysUserServiceImpl myUserService;

    @RequestMapping(value = "/myLogin")
    public String loginAction(SysUser user, Model model) {
        //// TODO: 2022/5/30  此处编写自定义的认证登录逻辑
        return "";
    }

    @RequestMapping(value = "/login-success",produces = "application/json;charset=utf-8")
    public String loginSuccess() {
        return "redirect:/home.jsp";
    }

    @RequestMapping(value = "/welcome")
    public String welcomeAdmin(ModelMap model) {
        model.addAttribute("message", "Spring Security logout example");
        return "index";
    }


}
